.class public Lcom/netease/util/task/ImageLoadingTask;
.super Lcom/netease/util/task/BaseDataAsyncTask;
.source "ImageLoadingTask.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/netease/util/task/BaseDataAsyncTask",
        "<",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        "Landroid/graphics/Bitmap;",
        ">;"
    }
.end annotation


# static fields
.field private static final RETRY_NUM:I = 0x3

.field private static final TAG:Ljava/lang/String; = "ImageLoadingTask"

.field private static final sBitmapCache:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/ref/SoftReference",
            "<",
            "Landroid/graphics/Bitmap;",
            ">;>;"
        }
    .end annotation
.end field

.field private static final sExecutor:Ljava/util/concurrent/ExecutorService;

.field public static final sThreadFactory:Ljava/util/concurrent/ThreadFactory;


# instance fields
.field private mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 39
    new-instance v0, Lcom/netease/util/task/ImageLoadingTask$1;

    invoke-direct {v0}, Lcom/netease/util/task/ImageLoadingTask$1;-><init>()V

    sput-object v0, Lcom/netease/util/task/ImageLoadingTask;->sThreadFactory:Ljava/util/concurrent/ThreadFactory;

    .line 48
    sget-object v0, Lcom/netease/util/task/ImageLoadingTask;->sThreadFactory:Ljava/util/concurrent/ThreadFactory;

    invoke-static {v0}, Ljava/util/concurrent/Executors;->newSingleThreadExecutor(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    .line 47
    sput-object v0, Lcom/netease/util/task/ImageLoadingTask;->sExecutor:Ljava/util/concurrent/ExecutorService;

    .line 52
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    .line 36
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;ILcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;)V
    .locals 0
    .parameter "context"
    .parameter "taskType"
    .parameter
    .parameter "param"

    .prologue
    .line 58
    .local p3, callback:Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;,"Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;"
    invoke-direct {p0, p1, p2, p3}, Lcom/netease/util/task/BaseDataAsyncTask;-><init>(Landroid/content/Context;ILcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;)V

    .line 59
    iput-object p4, p0, Lcom/netease/util/task/ImageLoadingTask;->mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;

    .line 60
    return-void
.end method

.method public static addBitmapCache(Ljava/lang/String;Landroid/graphics/Bitmap;)V
    .locals 3
    .parameter "key"
    .parameter "bitmap"

    .prologue
    .line 218
    sget-object v1, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    monitor-enter v1

    .line 219
    if-nez p1, :cond_0

    .line 220
    :try_start_0
    sget-object v0, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    invoke-virtual {v0, p0}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    .line 218
    :goto_0
    monitor-exit v1

    .line 225
    return-void

    .line 222
    :cond_0
    sget-object v0, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    new-instance v2, Ljava/lang/ref/SoftReference;

    invoke-direct {v2, p1}, Ljava/lang/ref/SoftReference;-><init>(Ljava/lang/Object;)V

    invoke-virtual {v0, p0, v2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_0

    .line 218
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public static deleteBitmapCache(Ljava/lang/String;)V
    .locals 4
    .parameter "key"

    .prologue
    .line 233
    sget-object v3, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    monitor-enter v3

    .line 234
    :try_start_0
    sget-object v2, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    invoke-virtual {v2, p0}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/ref/SoftReference;

    .line 235
    .local v1, ref:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;"
    if-eqz v1, :cond_0

    .line 236
    invoke-virtual {v1}, Ljava/lang/ref/SoftReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/graphics/Bitmap;

    .line 237
    .local v0, bitmap:Landroid/graphics/Bitmap;
    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->isRecycled()Z

    move-result v2

    if-nez v2, :cond_0

    .line 238
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->recycle()V

    .line 233
    .end local v0           #bitmap:Landroid/graphics/Bitmap;
    :cond_0
    monitor-exit v3

    .line 242
    return-void

    .line 233
    .end local v1           #ref:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;"
    :catchall_0
    move-exception v2

    monitor-exit v3
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v2
.end method

.method public static getBitmapCache(Ljava/lang/String;)Landroid/graphics/Bitmap;
    .locals 4
    .parameter "key"

    .prologue
    .line 250
    sget-object v3, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    monitor-enter v3

    .line 251
    const/4 v0, 0x0

    .line 252
    .local v0, bitmap:Landroid/graphics/Bitmap;
    :try_start_0
    sget-object v2, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    invoke-virtual {v2, p0}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/ref/SoftReference;

    .line 253
    .local v1, r:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;"
    if-nez v1, :cond_0

    const/4 v0, 0x0

    .line 257
    :goto_0
    monitor-exit v3

    return-object v0

    .line 253
    :cond_0
    invoke-virtual {v1}, Ljava/lang/ref/SoftReference;->get()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/graphics/Bitmap;

    move-object v0, v2

    goto :goto_0

    .line 250
    .end local v1           #r:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;"
    :catchall_0
    move-exception v2

    monitor-exit v3
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v2
.end method

.method public static getBitmapLocal(Landroid/content/Context;Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;)Landroid/graphics/Bitmap;
    .locals 9
    .parameter "context"
    .parameter "param"

    .prologue
    const/4 v0, 0x0

    .line 273
    if-nez p1, :cond_1

    .line 308
    :cond_0
    :goto_0
    return-object v0

    .line 276
    :cond_1
    iget-object v5, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;

    invoke-static {v5}, Lcom/netease/util/StringUtils;->getPathPart(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Lcom/netease/util/StringUtils;->removeInvalidFileNameChar(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    .line 277
    .local v4, name:Ljava/lang/String;
    invoke-static {v4}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v5

    if-nez v5, :cond_0

    .line 280
    const/4 v0, 0x0

    .line 282
    .local v0, bitmap:Landroid/graphics/Bitmap;
    iget-boolean v5, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mCheckAssert:Z

    if-eqz v5, :cond_2

    .line 284
    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    invoke-virtual {p0}, Landroid/content/Context;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v6

    .line 285
    new-instance v7, Ljava/lang/StringBuilder;

    sget-object v8, Lcom/netease/util/UtilConstants;->DIR_ASSETS_IMG:Ljava/lang/String;

    invoke-static {v8}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v8

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    .line 284
    invoke-virtual {v6, v7}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v6

    .line 285
    iget-object v7, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mOptions:Landroid/graphics/BitmapFactory$Options;

    .line 284
    invoke-static {v5, v6, v7}, Lcom/netease/util/PicUtils;->readBitmap(Landroid/content/res/Resources;Ljava/io/InputStream;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    .line 294
    :cond_2
    :goto_1
    if-nez v0, :cond_3

    .line 295
    invoke-static {p0, v4}, Lcom/netease/util/task/ImageLoadingTask;->getLocalFile(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;

    move-result-object v2

    .line 296
    .local v2, file:Ljava/io/File;
    if-eqz v2, :cond_3

    .line 297
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    iget-object v6, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mOptions:Landroid/graphics/BitmapFactory$Options;

    invoke-static {v5, v2, v6}, Lcom/netease/util/PicUtils;->readBitmap(Landroid/content/res/Resources;Ljava/io/File;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 298
    if-nez v0, :cond_3

    .line 300
    invoke-virtual {v2}, Ljava/io/File;->delete()Z

    .line 304
    .end local v2           #file:Ljava/io/File;
    :cond_3
    if-eqz v0, :cond_0

    iget-boolean v5, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mNeedCache:Z

    if-eqz v5, :cond_0

    .line 305
    iget-object v5, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mCacheKey:Ljava/lang/String;

    invoke-static {v5}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v5

    if-eqz v5, :cond_4

    iget-object v3, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;

    .line 306
    .local v3, key:Ljava/lang/String;
    :goto_2
    invoke-static {v3, v0}, Lcom/netease/util/task/ImageLoadingTask;->addBitmapCache(Ljava/lang/String;Landroid/graphics/Bitmap;)V

    goto :goto_0

    .line 286
    .end local v3           #key:Ljava/lang/String;
    :catch_0
    move-exception v1

    .line 287
    .local v1, e:Ljava/lang/Exception;
    if-eqz v0, :cond_2

    .line 288
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->recycle()V

    .line 289
    const/4 v0, 0x0

    goto :goto_1

    .line 305
    .end local v1           #e:Ljava/lang/Exception;
    :cond_4
    iget-object v3, p1, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mCacheKey:Ljava/lang/String;

    goto :goto_2
.end method

.method private static getLocalFile(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;
    .locals 3
    .parameter "context"
    .parameter "name"

    .prologue
    .line 177
    new-instance v0, Ljava/io/File;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-static {p0}, Lcom/netease/util/task/ImageLoadingTask;->getSaveDir(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 178
    .local v0, file:Ljava/io/File;
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-eqz v1, :cond_0

    .end local v0           #file:Ljava/io/File;
    :goto_0
    return-object v0

    .restart local v0       #file:Ljava/io/File;
    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private static getSaveDir(Landroid/content/Context;)Ljava/lang/String;
    .locals 2
    .parameter "context"

    .prologue
    .line 182
    invoke-static {}, Lcom/netease/util/SystemUtils;->isSDCardMounted()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-static {}, Lcom/netease/util/SystemUtils;->isSDCardMountedReadOnly()Z

    move-result v0

    if-nez v0, :cond_0

    .line 183
    sget-object v0, Lcom/netease/util/UtilConstants;->DIR_SDCARD_TMP_IMG:Ljava/lang/String;

    .line 185
    :goto_0
    return-object v0

    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Context;->getFilesDir()Ljava/io/File;

    move-result-object v1

    invoke-virtual {v1}, Ljava/io/File;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "/netease_temp_pic/"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public static hasBitmapCache(Ljava/lang/String;)Z
    .locals 2
    .parameter "key"

    .prologue
    .line 267
    sget-object v1, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    monitor-enter v1

    .line 268
    :try_start_0
    sget-object v0, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    invoke-virtual {v0, p0}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    monitor-exit v1

    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0

    .line 267
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public static removeRecyledCached()V
    .locals 7

    .prologue
    .line 194
    :try_start_0
    sget-object v5, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    monitor-enter v5
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 195
    :try_start_1
    sget-object v4, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    invoke-virtual {v4}, Ljava/util/HashMap;->entrySet()Ljava/util/Set;

    move-result-object v4

    .line 196
    invoke-interface {v4}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v2

    .line 197
    .local v2, iterator:Ljava/util/Iterator;,"Ljava/util/Iterator<Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;>;>;"
    :cond_0
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-nez v4, :cond_1

    .line 194
    monitor-exit v5

    .line 209
    .local v0, e:Ljava/lang/Exception;
    :goto_1
    return-void

    .line 198
    .end local v0           #e:Ljava/lang/Exception;
    :cond_1
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/util/Map$Entry;

    .line 199
    .local v1, entry:Ljava/util/Map$Entry;,"Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;>;"
    invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/ref/SoftReference;

    .line 200
    .local v3, sr:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;"
    if-eqz v3, :cond_2

    invoke-virtual {v3}, Ljava/lang/ref/SoftReference;->get()Ljava/lang/Object;

    move-result-object v4

    if-nez v4, :cond_0

    .line 201
    :cond_2
    sget-object v4, Lcom/netease/util/task/ImageLoadingTask;->sBitmapCache:Ljava/util/HashMap;

    invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v6

    invoke-virtual {v4, v6}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_0

    .line 194
    .end local v1           #entry:Ljava/util/Map$Entry;,"Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;>;"
    .end local v3           #sr:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Landroid/graphics/Bitmap;>;"
    :catchall_0
    move-exception v4

    monitor-exit v5
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :try_start_2
    throw v4
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    .line 205
    :catch_0
    move-exception v0

    .line 207
    .restart local v0       #e:Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_1
.end method


# virtual methods
.method protected varargs doInBackground([Ljava/lang/Void;)Landroid/graphics/Bitmap;
    .locals 8
    .parameter "params"

    .prologue
    const/4 v4, 0x0

    .line 69
    iget-object v5, p0, Lcom/netease/util/task/ImageLoadingTask;->mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;

    if-nez v5, :cond_0

    move-object v0, v4

    .line 101
    :goto_0
    return-object v0

    .line 89
    :cond_0
    const/4 v2, 0x0

    .line 90
    .local v2, retryNum:I
    :try_start_0
    iget-object v5, p0, Lcom/netease/util/task/ImageLoadingTask;->mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;

    iget-object v5, v5, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;

    invoke-static {v5}, Lcom/netease/util/task/ImageLoadingTask;->getBitmapCache(Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 91
    .local v0, bitmap:Landroid/graphics/Bitmap;
    if-nez v0, :cond_1

    .line 92
    iget-object v5, p0, Lcom/netease/util/task/ImageLoadingTask;->mContext:Landroid/content/Context;

    iget-object v6, p0, Lcom/netease/util/task/ImageLoadingTask;->mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;

    invoke-static {v5, v6}, Lcom/netease/util/task/ImageLoadingTask;->getBitmapLocal(Landroid/content/Context;Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;)Landroid/graphics/Bitmap;

    move-result-object v0

    move v3, v2

    .line 93
    .end local v2           #retryNum:I
    .local v3, retryNum:I
    :goto_1
    if-nez v0, :cond_3

    add-int/lit8 v2, v3, 0x1

    .end local v3           #retryNum:I
    .restart local v2       #retryNum:I
    const/4 v5, 0x3

    if-ge v3, v5, :cond_1

    invoke-virtual {p0}, Lcom/netease/util/task/ImageLoadingTask;->isCancelled()Z

    move-result v5

    if-nez v5, :cond_1

    .line 94
    iget-object v5, p0, Lcom/netease/util/task/ImageLoadingTask;->mContext:Landroid/content/Context;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    if-nez v5, :cond_2

    .line 103
    :cond_1
    :goto_2
    invoke-virtual {p0}, Lcom/netease/util/task/ImageLoadingTask;->closeHttpClient()V

    goto :goto_0

    .line 95
    :cond_2
    :try_start_1
    iget-object v5, p0, Lcom/netease/util/task/ImageLoadingTask;->mContext:Landroid/content/Context;

    iget-object v6, p0, Lcom/netease/util/task/ImageLoadingTask;->mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;

    const/4 v7, 0x1

    invoke-virtual {p0, v5, v6, v7}, Lcom/netease/util/task/ImageLoadingTask;->getBitmap(Landroid/content/Context;Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;Z)Landroid/graphics/Bitmap;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move-result-object v0

    move v3, v2

    .end local v2           #retryNum:I
    .restart local v3       #retryNum:I
    goto :goto_1

    .line 100
    .end local v0           #bitmap:Landroid/graphics/Bitmap;
    .end local v3           #retryNum:I
    .restart local v2       #retryNum:I
    :catch_0
    move-exception v1

    .line 103
    .local v1, e:Ljava/lang/Exception;
    invoke-virtual {p0}, Lcom/netease/util/task/ImageLoadingTask;->closeHttpClient()V

    move-object v0, v4

    .line 101
    goto :goto_0

    .line 102
    .end local v1           #e:Ljava/lang/Exception;
    :catchall_0
    move-exception v4

    .line 103
    invoke-virtual {p0}, Lcom/netease/util/task/ImageLoadingTask;->closeHttpClient()V

    .line 104
    throw v4

    .end local v2           #retryNum:I
    .restart local v0       #bitmap:Landroid/graphics/Bitmap;
    .restart local v3       #retryNum:I
    :cond_3
    move v2, v3

    .end local v3           #retryNum:I
    .restart local v2       #retryNum:I
    goto :goto_2
.end method

.method protected bridge varargs synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 1
    check-cast p1, [Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/netease/util/task/ImageLoadingTask;->doInBackground([Ljava/lang/Void;)Landroid/graphics/Bitmap;

    move-result-object v0

    return-object v0
.end method

.method public getBitmap(Landroid/content/Context;Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;Z)Landroid/graphics/Bitmap;
    .locals 12
    .parameter "context"
    .parameter "param"
    .parameter "needReturn"

    .prologue
    .line 119
    if-nez p2, :cond_1

    .line 120
    const/4 v7, 0x0

    .line 167
    :cond_0
    :goto_0
    return-object v7

    .line 123
    :cond_1
    iget-object v2, p2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;

    invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v2

    if-nez v2, :cond_6

    .line 126
    :try_start_0
    iget-object v2, p2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;

    invoke-static {v2}, Lcom/netease/util/StringUtils;->getPathPart(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 125
    invoke-static {v2}, Lcom/netease/util/StringUtils;->removeInvalidFileNameChar(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v10

    .line 127
    .local v10, name:Ljava/lang/String;
    invoke-static {v10}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v2

    if-eqz v2, :cond_2

    .line 128
    const/4 v7, 0x0

    goto :goto_0

    .line 132
    :cond_2
    invoke-virtual {p0}, Lcom/netease/util/task/ImageLoadingTask;->getHttpClient()Lcom/netease/util/http/AndroidHttpClient;

    move-result-object v0

    .line 133
    .local v0, httpClient:Lorg/apache/http/client/HttpClient;
    if-nez v0, :cond_3

    .line 134
    const/4 v7, 0x0

    goto :goto_0

    .line 136
    :cond_3
    invoke-interface {v0}, Lorg/apache/http/client/HttpClient;->getParams()Lorg/apache/http/params/HttpParams;

    move-result-object v9

    .line 137
    .local v9, httpParams:Lorg/apache/http/params/HttpParams;
    const/16 v2, 0xbb8

    invoke-static {v9, v2}, Lorg/apache/http/params/HttpConnectionParams;->setConnectionTimeout(Lorg/apache/http/params/HttpParams;I)V

    .line 138
    sget-boolean v2, Lcom/netease/util/UtilConstants;->NEED_IMG_URL_PREFEX:Z

    if-eqz v2, :cond_7

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {}, Lcom/netease/util/UtilConstants;->getImgUrlPrefex()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v3, p2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 140
    .local v1, url:Ljava/lang/String;
    :goto_1
    const/4 v2, 0x0

    const/4 v3, 0x0

    .line 141
    const-string v4, "GET"

    const/4 v5, 0x0

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    .line 140
    invoke-static/range {v0 .. v6}, Lcom/netease/util/HttpUtils;->getHttpBitmapResult(Lorg/apache/http/client/HttpClient;Ljava/lang/String;Ljava/util/List;[Lorg/apache/http/Header;Ljava/lang/String;Ljava/lang/String;Landroid/content/res/Resources;)Landroid/graphics/Bitmap;

    move-result-object v7

    .line 144
    .local v7, bitmap:Landroid/graphics/Bitmap;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {p1}, Lcom/netease/util/task/ImageLoadingTask;->getSaveDir(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 145
    iget-object v3, p2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mSize:Ljava/lang/String;

    iget-boolean v4, p2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mResized:Z

    iget-boolean v5, p2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mScaled:Z

    .line 144
    invoke-static {v7, v2, v3, v4, v5}, Lcom/netease/util/PicUtils;->saveBitmap(Landroid/graphics/Bitmap;Ljava/lang/String;Ljava/lang/String;ZZ)Landroid/graphics/Bitmap;

    move-result-object v11

    .line 146
    .local v11, saveBitmap:Landroid/graphics/Bitmap;
    if-eqz v7, :cond_4

    if-eq v11, v7, :cond_4

    .line 147
    invoke-virtual {v7}, Landroid/graphics/Bitmap;->recycle()V

    .line 148
    move-object v7, v11

    .line 151
    :cond_4
    if-eqz v7, :cond_5

    if-nez p3, :cond_5

    .line 152
    invoke-virtual {v7}, Landroid/graphics/Bitmap;->recycle()V

    .line 153
    const/4 v7, 0x0

    .line 156
    :cond_5
    if-eqz v7, :cond_0

    iget-object v2, p0, Lcom/netease/util/task/ImageLoadingTask;->mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;

    iget-boolean v2, v2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mNeedCache:Z

    if-eqz v2, :cond_0

    .line 157
    iget-object v2, p0, Lcom/netease/util/task/ImageLoadingTask;->mParam:Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;

    iget-object v2, v2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;

    invoke-static {v2, v7}, Lcom/netease/util/task/ImageLoadingTask;->addBitmapCache(Ljava/lang/String;Landroid/graphics/Bitmap;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto/16 :goto_0

    .line 161
    .end local v0           #httpClient:Lorg/apache/http/client/HttpClient;
    .end local v1           #url:Ljava/lang/String;
    .end local v7           #bitmap:Landroid/graphics/Bitmap;
    .end local v9           #httpParams:Lorg/apache/http/params/HttpParams;
    .end local v10           #name:Ljava/lang/String;
    .end local v11           #saveBitmap:Landroid/graphics/Bitmap;
    :catch_0
    move-exception v8

    .line 162
    .local v8, e:Ljava/lang/Exception;
    invoke-virtual {p0}, Lcom/netease/util/task/ImageLoadingTask;->closeHttpClient()V

    .line 163
    const-string v2, "ImageLoadingTask"

    const-string v3, "doInBackground error!!!"

    invoke-static {v2, v3, v8}, Lcom/netease/util/Logger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 167
    .end local v8           #e:Ljava/lang/Exception;
    :cond_6
    const/4 v7, 0x0

    goto/16 :goto_0

    .line 139
    .restart local v0       #httpClient:Lorg/apache/http/client/HttpClient;
    .restart local v9       #httpParams:Lorg/apache/http/params/HttpParams;
    .restart local v10       #name:Ljava/lang/String;
    :cond_7
    :try_start_1
    iget-object v1, p2, Lcom/netease/util/task/ImageLoadingTask$ImageLoadingParam;->mPath:Ljava/lang/String;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_1
.end method

.method public getExecutor()Ljava/util/concurrent/ExecutorService;
    .locals 1

    .prologue
    .line 63
    sget-object v0, Lcom/netease/util/task/ImageLoadingTask;->sExecutor:Ljava/util/concurrent/ExecutorService;

    return-object v0
.end method
